}
}
- let source = new Source(title, pid, sender, trayIcon);
+ let source = new Source(title, pid, sender, trayIcon, ndata ? ndata.hints['desktop-entry'] : null);
source.setTransient(isForTransientNotification);
if (!isForTransientNotification) {
Name: 'NotificationDaemonSource',
Extends: MessageTray.Source,
- _init: function(title, pid, sender, trayIcon) {
+ _init: function(title, pid, sender, trayIcon, appId) {
+ // Need to set the app before chaining up, so
+ // methods called from the parent constructor can find it
+ this.trayIcon = trayIcon;
+ this.pid = pid;
+ this.app = this._getApp(appId);
+
this.parent(title);
this.initialTitle = title;
- this.pid = pid;
+ if (this.app)
+ this.title = this.app.get_name();
+ else
+ this.useNotificationIcon = true;
+
if (sender)
this._nameWatcherId = Gio.DBus.session.watch_name(sender,
Gio.BusNameWatcherFlags.NONE,
else
this._nameWatcherId = 0;
- this._setApp();
- if (this.app)
- this.title = this.app.get_name();
- else
- this.useNotificationIcon = true;
-
- this.trayIcon = trayIcon;
if (this.trayIcon) {
- this._setSummaryIcon(this.trayIcon);
- this.useNotificationIcon = false;
+ // Try again finding the app, using the WM_CLASS from the tray icon
+ this._setSummaryIcon(this.trayIcon);
+ this.useNotificationIcon = false;
}
},
return true;
},
- _getApp: function() {
+ _getApp: function(appId) {
let app;
app = Shell.WindowTracker.get_default().get_app_from_pid(this.pid);
return app;
if (this.trayIcon) {
- app = Shell.AppSystem.get_default().lookup_wmclass(this.trayIcon.wmclass);
+ app = Shell.AppSystem.get_default().lookup_wmclass(this.trayIcon.wm_class);
+ if (app != null)
+ return app;
+ }
+
+ if (appId) {
+ app = Shell.AppSystem.get_default().lookup_app(appId + '.desktop');
if (app != null)
return app;
}
return null;
},
- _setApp: function() {
+ _setApp: function(appId) {
if (this.app)
return;
- this.app = this._getApp();
+ this.app = this._getApp(appId);
if (!this.app)
return;